﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="/img/logo.png">
<title>博客后台 - 编辑页面</title>
<link rel="stylesheet" href="plugin/layui/css/layui.css">
<link rel="stylesheet" href="css/back.css">
<link rel="stylesheet"
	href="plugin/font-awesome/css/font-awesome.min.css">
</head>
<body>
	<div class="layui-layout layui-layout-admin">
		<div class="layui-header">
			<div class="layui-logo">
				<a href="/admin" style="color: #009688;"> 风吟博客后台 </a>
			</div>
			<!-- 头部区域（可配合layui已有的水平导航） -->
			<ul class="layui-nav layui-layout-left">
				<li class="layui-nav-item"><a href="/" target="_blank">前台</a></li>
				<li class="layui-nav-item"><a href="javascript:;">新建</a>
					<dl class="layui-nav-child">
						<dd>
							<a href="/admin/article/insert">文章</a>
						</dd>
						<dd>
							<a href="/admin/page/insert">页面</a>
						</dd>
						<dd>
							<a href="/admin/category/insert">分类</a>
						</dd>
						<dd>
							<a href="/admin/notice/insert">公告</a>
						</dd>
						<dd>
							<a href="/admin/link/insert">链接</a>
						</dd>
					</dl></li>
			</ul>
			<ul class="layui-nav layui-layout-right">
				<li class="layui-nav-item"><a href="javascript:;"> <img
						src="uploads/2017/10/20171006225356181.jpg" class="layui-nav-img">
						admin
				</a>
					<dl class="layui-nav-child">
						<dd>
							<a href="/admin/user/profile">基本资料</a>
						</dd>
					</dl></li>
				<li class="layui-nav-item"><a href="/admin/logout">退出</a></li>
			</ul>
		</div>

		<div class="layui-side layui-bg-black">
			<div class="layui-side-scroll">
				<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
				<ul class="layui-nav layui-nav-tree" lay-filter="test">
					<li class="layui-nav-item layui-nav-itemed"><a class=""
						href="javascript:;">文章</a>
						<dl class="layui-nav-child">
							<dd>
								<a href="/admin/article">全部文章</a>
							</dd>
							<dd>
								<a href="/admin/article/insert">写文章</a>
							</dd>
							<dd>
								<a href="/admin/category">全部分类</a>
							</dd>
							<dd>
								<a href="/admin/tag">全部标签</a>
							</dd>
						</dl></li>
					<li class="layui-nav-item"><a href="javascript:;">页面</a>
						<dl class="layui-nav-child">
							<dd>
								<a href="/admin/page">全部页面</a>
							</dd>
							<dd>
								<a href="/admin/page/insert">添加页面</a>
							</dd>
						</dl></li>
					<li class="layui-nav-item"><a class="" href="javascript:;">
							链接 </a>
						<dl class="layui-nav-child">
							<dd>
								<a href="/admin/link">全部链接</a>
							</dd>
							<dd>
								<a href="/admin/link/insert">添加链接</a>
							</dd>
						</dl></li>
					<li class="layui-nav-item"><a href="javascript:;">公告</a>
						<dl class="layui-nav-child">
							<dd>
								<a href="/admin/notice">全部公告</a>
							</dd>
							<dd>
								<a href="/admin/notice/insert">添加公告</a>
							</dd>
						</dl></li>
					<li class="layui-nav-item"><a href="/admin/comment"> 评论 </a></li>
					<li class="layui-nav-item"><a class="" href="javascript:;">
							用户 </a>
						<dl class="layui-nav-child">
							<dd>
								<a href="/admin/user">全部用户</a>
							</dd>
							<dd>
								<a href="/admin/user/insert">添加用户</a>
							</dd>
						</dl></li>
					<li class="layui-nav-item"><a href="javascript:;">设置</a>
						<dl class="layui-nav-child">
							<dd>
								<a href="/admin/menu">菜单</a>
							</dd>
							<dd>
								<a href="/admin/options">主要选项</a>
							</dd>
						</dl></li>
				</ul>
			</div>
		</div>

		<div class="layui-body">
			<!-- 内容主体区域 -->
			<div style="padding: 15px;">
				<blockquote class="layui-elem-quote">
					<span class="layui-breadcrumb" lay-separator="/"> <a
						href="/admin">首页</a> <a href="/admin/page">页面列表</a> <a><cite>新建页面</cite></a>
					</span>
				</blockquote>


				<form class="layui-form" method="post" id="myForm"
					action="/admin/page/insertSubmit">
					<div class="layui-form-item">
						<label class="layui-form-label">别名<span
							style="color: #FF5722;">*</span></label>
						<div class="layui-input-inline">
							<input type="text" name="pageKey" lay-verify="key" id="key"
								value="" class="layui-input">
						</div>
						<div class="layui-form-mid layui-word-aux">
							请填写2到20位，仅允许字母、下划线和减号组成（<span style="color: #FF5722;">请确保别名没重复</span>）
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">标题 <span
							style="color: #FF5722;">*</span></label>
						<div class="layui-input-inline">
							<input type="text" name="pageTitle" lay-verify="title" id="title"
								value="" class="layui-input">
						</div>
					</div>

					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label">内容 <span
							style="color: #FF5722;">*</span></label>
						<div class="layui-input-block">
							<textarea class="layui-textarea layui-hide" name="pageContent"
								id="content"></textarea>
						</div>
					</div>

					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn" lay-submit="" lay-filter="demo1">新建</button>
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</form>

			</div>
		</div>

		<div class="layui-footer">
			<!-- 底部固定区域 -->
			© 这里展示一些提示性信息 <a href="#" target="_blank">其他导航</a> / <a href="#"
				target="_blank">其他导航</a>
		</div>
	</div>

	<script src="js/jquery.min.js"></script>
	<script src="plugin/layui/layui.all.js"></script>
	<script src="js/back.js"></script>
	<script>
		layui
				.use(
						[ 'form', 'layedit', 'laydate' ],
						function() {
							var form = layui.form, layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate;

							//上传图片,必须放在 创建一个编辑器前面
							layedit.set({
								uploadImage : {
									url : '/admin/upload/img' //接口url
									,
									type : 'post' //默认post
								}
							});

							//创建一个编辑器
							var editIndex = layedit.build('content', {
								height : 350,
							});

							layui.code({
								elem : 'pre', //默认值为.layui-code
							});

							//自定义验证规则
							form.verify({
								title : function(value) {
									if (value.length < 2) {
										return '标题至少得2个字符啊';
									}
								},
								key : [ /^[a-zA-Z_-]{2,20}$/, '别名输入不规范' ],
								content : function(value) {
									layedit.sync(editIndex);
								}
							});
							layedit.build('content', {
								tool : [ 'strong' //加粗
								, 'italic' //斜体
								, 'underline' //下划线
								, 'del' //删除线

								, '|' //分割线

								, 'left' //左对齐
								, 'center' //居中对齐
								, 'right' //右对齐
								, 'link' //超链接
								, 'unlink' //清除链接
								, 'face' //表情
								, 'image' //插入图片
								, 'code' ]
							});

						})
	</script>

	<script>
		//给文本编辑器的iframe引入代码高亮的css
		$("iframe").contents().find("head").append(
				"<link rel=\"stylesheet\" href=\"/css/highlight.css\">\n");
	</script>

</body>
</html>
